package com.smart.fourteen.hibernate.template.dao;

import com.smart.fourteen.hibernate.model.Topic;
import org.hibernate.SessionFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.hibernate5.HibernateTemplate;

public class TestSpring {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("com/smart/fourteen/hibernate/template/dao/applicationContext-spring-hibernatetemplate.xml");
        TopicDao topicDao = (TopicDao)ac.getBean("topicDao");
        System.out.println(topicDao);
        Topic topic = new Topic();
        topic.setName("a");

        topicDao.addTopic(topic);

        Topic getTopic = topicDao.getTopic(1);
        System.out.println(getTopic);
    }
}
